// import { getToken, setToken,setRoles,getRoles,setUser,getUser, removeToken } from '@/utils/auth'
const SET_CODE = 'SET_CODE'
const scode = {
  state: {
    code:''
  },
  mutations: {
    [SET_CODE]:(state, userinfo) => {state.userinfo = userinfo},
  },

  actions: {
    // 用户名登录
 /*   LoginByUsername({ commit }, userInfo) {
      const username = userInfo.username.trim()
      return new Promise((resolve, reject) => {
        loginByUsername(username, userInfo.password).then(res => {
          if(res.code == 0){
            const data = res.data
            setToken(data.auth)  //登录成功后将token存储在cookie之中 用户获取信息传token到服务器,来验证用户的信息
            commit('SET_TOKEN', data.auth)
            setUser(data) //存入cookie
            resolve(data);
          }else{
            console.log(res);
          }
        }).catch(error => {
          reject(error)
        })

      })
    },*/




  }
}

export default scode
